<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>学生信息维护</title>
<%@include file="/view/common/js-css.jsp" %>
</head>
<body>
	<div id="frameWrapper" class="frameWrapper">
	 <div class="titlebar">
		 <p>当前位置：学生管理<span>/</span>信息维护</p>
	 </div>
	<!--检索-->
	<div class="searchbar">
		<form method="post" action="TeacherServlet?command=preUpdate">
			<div id="input">
				<div class="inputwraper">
					<span>班级：</span>
					<input type="text" name="gradeName" value="${gradeName }" />
				</div>
				<div id="sub-btn">
					<input type="submit" value="搜素">
				</div>
				<div class="clear"></div>
			</div>
		</form>
	</div>   
	<div id="table-wrap">
		<table border="1"><!--检索-->
			<thead>
				<tr>
					<th>ID</th>
					<th>学生学号</th>
					<th>姓名</th>
					<th>性别</th>
					<th>班级</th> 
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${studentPage.list }" var="student">
				  <tr>   
						<td>${student.student_id }</td >
						<td>${student.student_sno }</td>
						<td>${student.student_name }</td>
						<td>${student.student_sex }</td>
						<c:forEach items="${gradeList }" var="grade">
							<c:if test="${grade.grade_id == student.grade_id }">
								<td>${grade.grade_name }</td>
							</c:if>
						</c:forEach>
						<td width="30%">
					         <a class="btn btn-del" href="TeacherServlet?command=delete&studentId=${student.student_id }" onclick="return confirm('确认删除？')">删除</a> 
							 <a class="btn btn-update" href="TeacherServlet?command=selectStudentById&studentId=${student.student_id }">修改</a>
						</td>
				  </tr>
				</c:forEach>
			</tbody>
			<tfoot>
			 	<tr>
					<th>ID</th>
					<th>学生学号</th>
					<th>姓名</th>
					<th>性别</th>
					<th>班级</th> 
				</tr>
			</tfoot>
			<!--分页按钮 end-->
		</table>
		<div id="paging">
			<a class="btn btn-getionfo" href="TeacherServlet?command=preUpdate&currentPage=1&gradeName=${gradeName }">首页</a>
			<a class="btn btn-getionfo" href="TeacherServlet?command=preUpdate&currentPage=${studentPage.currentPage-1<1?1:studentPage.currentPage-1 }&gradeName=${gradeName }">上一页</a>
			&nbsp;&nbsp;&nbsp;&nbsp;
			共<span>${studentPage.pageTotal }</span>页
			&nbsp;&nbsp;&nbsp;&nbsp;
			当前第<span>${studentPage.currentPage }</span>页
			&nbsp;&nbsp;&nbsp;&nbsp;
			<a class="btn btn-getionfo" href="TeacherServlet?command=preUpdate&currentPage=${studentPage.currentPage+1<studentPage.currentPage+1?studentPage.currentPage+1:studentPage.pageTotal }&gradeName=${gradeName }">下一页</a>
			<a class="btn btn-getionfo" href="TeacherServlet?command=preUpdate&currentPage=${studentPage.pageTotal }&gradeName=${gradeName }">末页</a>
		</div>
	</div>
</div>
</body>
</html>